package com.auotc.livedatademo

import android.arch.lifecycle.Observer
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    val MAIN_TAG = "T3"

    val myData = MyData()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        tv_text.setOnClickListener {
            myData.changeValue(myData.value + "~")
        }
        myData.observe(this, Observer {
            Log.i(MAIN_TAG, "onChanged: $it")
        })
    }
}
